﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PMS.Client.Entities;
using PMS.Client.Utils;

namespace PMS.Client.BLL
{
    public class ServiceBase
    {
        public T GetResult<T>(string json)
        {
            var result = JsonUtil.Deserializer<Result<T>>(json);

            if (result == null)
                throw new Exception("数据获取失败!");
            if (result.state != 200)
                throw new Exception(result.exceptionMessage);

            return result.data;
        }
    }
}
